<template>
  <div>
    <!-- <text class="p-3"
          @click="fetchRtmp">获取视频地址</text> -->

    <!-- <monitor-video class="monitor-video"
                   :url="url"></monitor-video> -->
  </div>
</template>
<script>
const vmMonitor = weex.requireModule('vmMonitor')

export default {
  components: {},
  props: {},
  data() {
    return {
      device: {},
      url: ''
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getParams()
  },
  mounted() { },
  methods: {
    async getParams() {
      const res = await this.$router.getParams()
      this.device = res && res.data || {}
      if (!this.device.doid) {
        return this.$notice.toast({ message: '没有视频设备' })
      }
      this.fetchRtmp()
    },
    fetchRtmp() {
      this.url = 'rtmp://47.94.17.55:30001/live?token=a40db168244745af9619584901496874|rtmpUrltype=clientFetch|systemType=5|tId=76766930835594240|lHost=172.17.177.241:30002/realTime_01101002D8F0615E9_0_0'

      vmMonitor.openUrl(this.url)

      // this.$http({
      //   method: 'GET',
      //   name: 'auth.video.rtmp.address',
      //   data: {
      //     deviceSn: this.device.doid,
      //     pushStreamMode: 2,
      //     videoResolution: 1,
      //     videoType: 0,
      //     clientType: 5
      //   }
      // }).then(res => {
      //   this.url = (res && res.fetchRtmpAddress) || ''
      // }).catch(err => {
      //   this.$notice.toast({ message: '获取视频地址失败' })
      // })
    }
  }
}
</script>
<style lang="scss" scoped>
.p-3 {
  padding: 30px;
}
.monitor-video {
  width: 750;
  height: 500;
}
</style>
